﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using KerriganInterface.IServiceClient;
using KerriganDataContract;
using KerriganService.DAC;
using KerriganDataContract.Blog;
using KerriganDataContract.Person;
using KerriganDataContract.Customer;
using KerriganDataContract.Authentification;

namespace KerriganService.ServiceClient
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "BlogService" in code, svc and config file together.
    public class BlogService : IBlogService
    {
        public PersonDC GetPerson(int id)
        {
            PersonDC dc = new PersonDC();

            try
            {
                return dc = PersonDAC.GetPerson(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public void UpdatePerson(PersonDC dc)
        {
            try
            {
                PersonDAC.UpdatePerson(dc);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public void DeletePerson(int id)
        {
            try
            {
                PersonDAC.DeletePerson(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public void CreatePerson(PersonDC dc)
        {
            try
            {
                PersonDAC.CreatePerson(dc);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public List<PersonDC> GetAllPerson()
        {
            try
            {
                return PersonDAC.GetAllPerson();
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public CustomerDC GetCustomer(int id)
        {
            try
            {
                return CustomerDAC.GetCustomer(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }




        public AuthenticateUserDC CheckLoginUser(string nickName, string password)
        {
            try
            {
                return AuthenticationDAC.CheckLoginUser(nickName, password);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public List<vwGetArticlesMoto> GetArticleMotoToDisplay()
        {
            try
            {
                return ArticleDAC.GetArticleMotoToDisplay();
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public List<vwGetArticle> GetArticleToDisplay()
        {
            try
            {
                return ArticleDAC.GetArticleToDisplay();
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public List<vwGetArticlesCar> GetArticleCarToDisplay()
        {
            try
            {
                return ArticleDAC.GetArticleCarToDisplay();
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public List<vwGetArticlesRoadSafety> GetArticleRoadSafetyToDisplay()
        {
            try
            {
                return ArticleDAC.GetArticleRoadSafetyToDisplay();
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }

        public PersonDC GetAllSession(int id)
        {
            throw new NotImplementedException();
        }


        public BlogDC GetAritcleById(int id)
        {
            try
            {
                return ArticleDAC.GetAritcleById(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public List<vwGetCategory> GetCategoryToDisplay()
        {
            try
            {
                return ArticleDAC.GetCategoryToDisplay();
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void UpdateArticle(int id, BlogDC bo)
        {
            try
            {
                ArticleDAC.UpdateArticle(id,bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void AddArticle(BlogDC bo)
        {
            try
            {
                ArticleDAC.AddArticle(bo);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void DeleteArticle(int id)
        {
            try
            {
                ArticleDAC.DeleteArticle(id);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void AddCustomer(CustomerDC dc)
        {
            try
            {
                CustomerDAC.AddCustomer(dc);
            }
            catch (Exception ex)
            {
                throw new FaultException("Un message d'erreur exemple.");
            }
        }


        public void DeleteCustomer(CustomerDC dc)
        {
            throw new NotImplementedException();
        }
    }
}
